/**
 * Copyright (C) 2009 All Rights Reserved
 * @author sebastian chang
 * @brief practice
 */

#ifndef _THREAD_EVENT_H_
#define _THREAD_EVENT_H_

#include <semaphore.h>

namespace trident {

class thread_event_t
{
public:
    /**
     * @brief constructor
     */
    thread_event_t();

    /**
     * @brief destructor
     */
    ~thread_event_t();

    /**
     * @brief initializes the thread event
     * @return bool
     */
    int init(bool state_ = false);

    /**
     * @brief waits for thread event
     * @return int which is millisecond
     */
     int waitEvent(unsigned long timeout_);

    /**
     * @brief sets thread event
     * @return int
     */
    int setEvent();

private:
    sem_t   _sem;
};


} // namespace trident

#endif // _THREAD_EVENT_H_

